﻿<Window xmlns:UserControls="clr-namespace:MyPoints.UserControls"  x:Class="MyPoints.EditImageWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:cnv="clr-namespace:MyPoints.UserControls.Converters"
        xmlns:local="clr-namespace:MyPoints"
        mc:Ignorable="d"
        Title="EditImageWindow" Height="373.421" Width="300">
  <Window.Resources>
    <sys:String x:Key="ImageFileFilter">Image files |*.png;*.bmp;*.jpg;*.gif|All files (*.*)|*.*</sys:String>
  </Window.Resources>
  <DockPanel>
    <DockPanel DockPanel.Dock="Bottom" Margin="0 16 0 0">
      
      <Button DockPanel.Dock="Right" x:Name="btnOk" Width="100" Content="Set" Margin="0 10 10 10" IsCancel="True" Click="btnOk_Click" />
      <Button DockPanel.Dock="Left" x:Name="btnCancel" Width="100" Content="Cancel" Margin="0 10 8 10" IsDefault="True" />
    </DockPanel>
    <StackPanel x:Name="pnlAccordion">
      <Expander x:Name="expWeb" Header="Image at WWW">
        <StackPanel>
          <TextBlock FontSize="8" TextWrapping="WrapWithOverflow">
          Web image is an image located on the web identified by its "URL" address. In most browsers you can get this address by opening
          the context menu over the image (right click of the mouse), showing the properties of the image and look for something like "url", or "address".
          This image is available when computer is connected to the Internet.
          </TextBlock>
          <Label Content="Target image URL:" />
          <TextBox x:Name="txtUrl" Text="{Binding Value, Mode=TwoWay}" />
        </StackPanel>
      </Expander>
      <Expander x:Name="expEmbedded" Header="Embedded image">
        <StackPanel>
          <TextBlock FontSize="8" TextWrapping="WrapWithOverflow">
        Embedded image will be included in the XML file with coordinates (gpx or xml file). This RAPIDLY INCREASES SIZE of the XML file and therefore
        this option is not suggested! However, using this approach will ensure that the image will be allways available. To reduce the size of the final
        image, the image might be resized to fixed, smaller size.
          </TextBlock>
          <Label Content="Select file with image:" />
          <UserControls:SelectFile Filter="{StaticResource ImageFileFilter}" Mode="File" Selected="{Binding Value, Mode=TwoWay}" />
          <DockPanel LastChildFill="True">
            <Label DockPanel.Dock="Left" Content="Select maximal image width:" />
            <ComboBox x:Name="cmbImageSize">
              <ComboBoxItem Content="120" />
              <ComboBoxItem Content="240" />
              <ComboBoxItem Content="360" />
              <ComboBoxItem Content="480" IsSelected="True" />
            </ComboBox>
          </DockPanel>
        </StackPanel>
      </Expander>
      <Expander x:Name="expFile" Header="File on the computer" IsEnabled="True">
        <StackPanel>
          <TextBlock FontSize="8" TextWrapping="WrapWithOverflow">
          Image from the computer will be saved in the XML file as path to the image relative to the path of GPX/XML file. 
          If image file location, or GPX/XML file location changes, the image will be not available.
          </TextBlock>
          <Label Content="Path to the image file:" />
          <UserControls:SelectFile x:Name="ctrFile" Filter="{StaticResource ImageFileFilter}" Mode="File" Selected="{Binding Value, Mode=TwoWay}" />
        </StackPanel>
      </Expander>
      <Expander x:Name="expFolder" Header="Folder on the computer - album" IsExpanded="True">
        <StackPanel>
          <TextBlock FontSize="8" TextWrapping="WrapWithOverflow">
          Path to the folder containing images on computer will be saved in the XML file as path to the folder relative to the path of GPX/XML file. 
          If folder location or GPX/XML file location changes, the album will be not available.
          </TextBlock>
          <Label Content="Path to the image folder:" />
          <UserControls:SelectFile x:Name="ctrFolder" Mode="Folder" Selected="{Binding Value, Mode=TwoWay}" />
        </StackPanel>
      </Expander>
    </StackPanel>
  </DockPanel>
</Window>
